<?php
/**
 * @copyright meila.com
 * @author 新华@
 * @name 
 * @param 
 *         $xxx = 作用
 * @static 
 *         XXX = 作用
 * 
 * 
 */
$dir = dirname(__FILE__);
include($dir.'/__queue_global.php');
//ml_tool_sendMq::intra_del_by_rid('00000070010000xyk');
class ml_mq_intra_del_by_rid extends MqClass{
    const QUEUE_NAME = ML_QUEUENAME_INTRA_DEL_BY_RID;
    public function __construct($queue)
    {

        parent::__construct($queue);
    }

    public function run_job(){
        //接收的数据
        $oContent = new ml_model_dbContent();
        $oILike = new ml_model_dbILike();
        $oLikeMe = new ml_model_dbLikeMe();
        $oPicFeed = new ml_model_dbPicFeed();
        $oPubFeed = new ml_model_dbPubFeed();
        $oUserFeed = new ml_model_dbUserfeed();
        $oGuang24 = new ml_model_guang_db24hour();
        $oGuang7d = new ml_model_guang_db7day();
        $oGuangByCtg = new ml_model_guang_dbByCtg();
        $oGuangByTag = new ml_model_guang_dbByTag();
        
        $arr = $this->src_data;
        $rid=$arr['rid'];
        echo $rid;
        $result['rDb_24'] = $oGuang24->del_by_rid($rid);
        /**
        * @todo 系统繁忙
        */
        $result['rDb_7d'] = $oGuang7d->del_by_rid($rid);
        $result['rDb_byctg'] = $oGuangByCtg->del_by_rid($rid);
        $result['rDb_bytag'] = $oGuangByTag->del_by_rid($rid);

        $uid = ml_tool_resid::resid2uid($rid);
        $result['rDb_likeme'] = $oLikeMe->getUidsByRid($uid, $rid,ML_ATTITUDE_LOVE,$uids);
        $aUid = array();
        foreach ($uids as $value) {
            $aUid[]=$value['act_uid'];
        }
        
        if(count($aUid)>0){
            $result['rDb_ilike'] = $oILike->update_when_del_content($aUid,$rid);//删ilike
        }
        $result['rDb_content'] = $oContent->del_contentByRid($rid);
        $result['rDb_userfeed'] = $oUserFeed->del_contentByContent_rid($rid);
        $result['rDb_pubfeed'] = $oPubFeed->delByContent_rid($rid);//删PubFeed
        $result['rDb_picfeed'] = $oPicFeed->delByContent_rid($rid);//删PicFeed
        var_dump($result);
        return true;
    }

}

ml_run_queue_check(ml_mq_intra_del_by_rid::QUEUE_NAME);
$xblog_obj = new ml_mq_intra_del_by_rid(new McQueue(ml_mq_intra_del_by_rid::QUEUE_NAME));
$argv[1]   = __FILE__;
$xblog_obj->setArgv($argv[1]);
$xblog_obj->execute();
?>